package org.jivesoftware.smackx.entitycaps.provider;

import java.io.IOException;
import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.packet.PacketExtension;
import org.jivesoftware.smack.provider.PacketExtensionProvider;
import org.jivesoftware.smackx.entitycaps.packet.CapsExtension;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

public class CapsExtensionProvider
  implements PacketExtensionProvider
{
  public PacketExtension parseExtension(XmlPullParser paramXmlPullParser)
    throws XmlPullParserException, IOException, XMPPException
  {
    String str1 = null;
    String str2 = null;
    String str3 = null;
    if ((paramXmlPullParser.getEventType() == 2) && (paramXmlPullParser.getName().equalsIgnoreCase("c")))
    {
      str1 = paramXmlPullParser.getAttributeValue(null, "hash");
      str2 = paramXmlPullParser.getAttributeValue(null, "ver");
      str3 = paramXmlPullParser.getAttributeValue(null, "node");
    }
    else
    {
      throw new XMPPException("Malformed Caps element");
    }
    paramXmlPullParser.next();
    if ((paramXmlPullParser.getEventType() != 3) || (!paramXmlPullParser.getName().equalsIgnoreCase("c")))
      throw new XMPPException("Malformed nested Caps element");
    if ((str1 != null) && (str2 != null) && (str3 != null))
      return new CapsExtension(str3, str2, str1);
    throw new XMPPException("Caps elment with missing attributes");
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smackx.entitycaps.provider.CapsExtensionProvider
 * JD-Core Version:    0.6.1
 */